LEX=flex -Cef -v

all: test.c test lex.out

lex.nxt.out: test.c
	cat $? | sed -r '/static yy_state_type yy_get_previous_state/,$$d;1,/static yyconst flex_int16_t yy_nxt/d;/^[ \t]*[\{\}]?[,; \t]*$$/d' | sed 1d | cat -b > $@

lex.accept.out: test.c
	cat $? | sed '1,/static yyconst flex_int16_t yy_accept/d;/static yyconst flex_int32_t yy_ec/,$$d' | tr -d '\n' | sed -r 's/[\{\},; \t]+/ /g' | tr ' ' '\n' | sed 1,2d | cat -b > $@

lex.out: lex.nxt.out lex.accept.out
	while read x <&3; do read y <&4; echo -e "$$x     |  $$y"; done 3<lex.nxt.out 4<lex.accept.out > $@

clean:
	rm -f test.c test *.out a/test b/test c/test

